﻿#region Usings

using System.Data.Entity.ModelConfiguration;
using Rail.Net.Core.Model;

#endregion

namespace Rail.Net.Data.Configuration
{
    public class ContengentTrainNumberMap : EntityTypeConfiguration<ContengentTrainNumber>
    {
        public ContengentTrainNumberMap()
        {
            ToTable("ContengentTrainNumbers");
            HasKey(contengentTrainNumber => contengentTrainNumber.Id);

            Property(contengentTrainNumber => contengentTrainNumber.TrainNumber).IsRequired().HasMaxLength(10);
            Property(contengentTrainNumber => contengentTrainNumber.Include).IsRequired();
            Property(contengentTrainNumber => contengentTrainNumber.Domestic).IsRequired();
            Property(contengentTrainNumber => contengentTrainNumber.International).IsRequired();
            Property(contengentTrainNumber => contengentTrainNumber.ValidFrom).IsOptional();
            Property(contengentTrainNumber => contengentTrainNumber.ValidTo).IsOptional();
        }
    }
}